<?php
use yii\helpers\Url;
use yii\web\View;
use app\assets\CreativeVideoPreviewAsset;
CreativeVideoPreviewAsset::register($this);
$this->title = \Yii::t('creative', 'Creative Preview').'--'.\Yii::$app->params['sysMsg']['company'].' Ad Server';
?>
<style>
  html,body,.cont{background-color: #fff;} 
</style>

<input type="hidden" class="creative-id" name="uuid" value="<?=$creative['id']?>">
<input type="hidden" class="creative-width" name="width" value="<?=$creative['width']?>" >
<input type="hidden" class="creative-height" name="height" value="<?=$creative['height']?>" >
 <?php
	switch ($creative['format_id']) {
   		  case 1:
            $type = 'jpg';
            break;
		    case 2:
            $type = 'png';
            break;
		    case 3:
            $type = 'swf';
            break;
        case 5:
            $type = 'flv';
             break;
        case 6:
            $type = 'mp4';
            break;
        default:
            $type = 'flv';
            break;
        }
        $preview = <<<FINE
               <input type="hidden" class="creative-type" name="type" value="$type" >
FINE;
        echo $preview;
?>
        <input type="hidden" class="creative-url" name="url" value="<?=$videoUrl?>">
        <div id="creative-preview-wrap" class="creative-preview-wrap"></div>
<?php
  $videoPluginUrl = Yii::getAlias('@web/').Yii::$app->params['envDir'].'/js/vendor/flowplayer/flowplayer.swf';
  $materialListUrl = $videoData;
  $this->registerJs("VAM.setVar('VIDEO_PLUGIN_URL','$videoPluginUrl');", View::POS_END);
  $this->registerJs("VAM.setVar('MATERIAL_LIST_URL','$materialListUrl');", View::POS_END);
?>
<script type="text/javascript" >
  requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/site.js"], function(common) {
    requirejs(["<?= Yii::getAlias('@web/').Yii::$app->params['envDir'];?>/js/creative/creativeMobileVideoPreview.js"]);
  });
</script>